<!-- HTML header for doxygen 1.9.4-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>yyjson: Introduction</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only-darkmode-toggle.css" rel="stylesheet" type="text/css"/>
<link href="yyjson-style.css" rel="stylesheet" type="text/css"/>
<!-- css awesome -->
 <script type="text/javascript" src="doxygen-awesome-darkmode-toggle.js"></script>
 <script type="text/javascript">
     DoxygenAwesomeDarkModeToggle.init()
 </script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname"><a href="index.html">yyjson</a><span id="projectnumber">&#160;0.10.0</span>
   </div>
   <div id="projectbrief">A high performance C JSON library.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('index.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div><div class="header">
  <div class="headertitle"><div class="title">Introduction </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p ><a class="anchor" id="md_README"></a> <a href="https://github.com/ibireme/yyjson/actions/workflows/cmake.yml"><img src="https://img.shields.io/github/actions/workflow/status/ibireme/yyjson/cmake.yml?branch=master&amp;style=flat-square" alt="Build" class="inline"/></a> <a href="https://codecov.io/gh/ibireme/yyjson"><img src="https://img.shields.io/codecov/c/github/ibireme/yyjson/master?style=flat-square" alt="Codecov" class="inline"/></a> <a href="https://github.com/ibireme/yyjson/blob/master/LICENSE"><img src="https://img.shields.io/github/license/ibireme/yyjson?color=blue&amp;style=flat-square" alt="License" class="inline"/></a> <a href="https://github.com/ibireme/yyjson/releases"><img src="https://img.shields.io/github/v/release/ibireme/yyjson?color=orange&amp;style=flat-square" alt="Version" class="inline"/></a> <a href="https://repology.org/project/yyjson/versions"><img src="https://img.shields.io/repology/repositories/yyjson.svg?style=flat-square" alt="Packaging status" style="pointer-events: none;" class="inline"/></a></p>
<p >A high performance JSON library written in ANSI C.</p>
<h1><a class="anchor" id="autotoc_md1"></a>
Features</h1>
<ul>
<li><b>Fast</b>: can read or write gigabytes per second JSON data on modern CPUs.</li>
<li><b>Portable</b>: complies with ANSI C (C89) for cross-platform compatibility.</li>
<li><b>Strict</b>: complies with <a href="https://datatracker.ietf.org/doc/html/rfc8259">RFC 8259</a> JSON standard, ensuring strict number format and UTF-8 validation.</li>
<li><b>Extendable</b>: offers options to allow comments, trailing commas, NaN/Inf, and custom memory allocator.</li>
<li><b>Accuracy</b>: can accurately read and write <code>int64</code>, <code>uint64</code>, and <code>double</code> numbers.</li>
<li><b>Flexible</b>: supports unlimited JSON nesting levels, <code>\u0000</code> characters, and non null-terminated strings.</li>
<li><b>Manipulation</b>: supports querying and modifying using <a href="https://datatracker.ietf.org/doc/html/rfc6901">JSON Pointer</a>, <a href="https://datatracker.ietf.org/doc/html/rfc6902">JSON Patch</a> and <a href="https://datatracker.ietf.org/doc/html/rfc7386">JSON Merge Patch</a>.</li>
<li><b>Developer-Friendly</b>: easy integration with only one <code>h</code> and one <code>c</code> file.</li>
</ul>
<h1><a class="anchor" id="autotoc_md2"></a>
Limitations</h1>
<ul>
<li>An array or object is stored as a <a href="https://ibireme.github.io/yyjson/doc/doxygen/html/md_doc__data_structure.html">data structure</a> such as linked list, which makes accessing elements by index or key slower than using an iterator.</li>
<li>Duplicate keys are allowed in an object, and the order of the keys is preserved.</li>
<li>JSON parsing result is immutable, requiring a <code>mutable copy</code> for modification.</li>
</ul>
<h1><a class="anchor" id="autotoc_md3"></a>
Performance</h1>
<p >Benchmark project and dataset: <a href="https://github.com/ibireme/yyjson_benchmark">yyjson_benchmark</a></p>
<p >The simdjson's new <code>On Demand</code> API is faster if most JSON fields are known at compile-time. This benchmark project only checks the DOM API, a new benchmark will be added later.</p>
<h4><a class="anchor" id="autotoc_md4"></a>
AWS EC2 (AMD EPYC 7R32, gcc 9.3)</h4>
<p ><img src="perf_reader_ec2.svg" alt="" style="pointer-events: none;" class="inline" title="ec2_chart"/>    </p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">twitter.json   </th><th class="markdownTableHeadNone">parse (GB/s)   </th><th class="markdownTableHeadNone">stringify (GB/s)    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">yyjson(insitu)   </td><td class="markdownTableBodyNone">1.80   </td><td class="markdownTableBodyNone">1.51    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">yyjson   </td><td class="markdownTableBodyNone">1.72   </td><td class="markdownTableBodyNone">1.42    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">simdjson   </td><td class="markdownTableBodyNone">1.52   </td><td class="markdownTableBodyNone">0.61    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">sajson   </td><td class="markdownTableBodyNone">1.16   </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">rapidjson(insitu)   </td><td class="markdownTableBodyNone">0.77   </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">rapidjson(utf8)   </td><td class="markdownTableBodyNone">0.26   </td><td class="markdownTableBodyNone">0.39    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">cjson   </td><td class="markdownTableBodyNone">0.32   </td><td class="markdownTableBodyNone">0.17    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">jansson   </td><td class="markdownTableBodyNone">0.05   </td><td class="markdownTableBodyNone">0.11   </td></tr>
</table>
<h4><a class="anchor" id="autotoc_md5"></a>
iPhone (Apple A14, clang 12)</h4>
<p ><img src="perf_reader_a14.svg" alt="" style="pointer-events: none;" class="inline" title="a14_chart"/>    </p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">twitter.json   </th><th class="markdownTableHeadNone">parse (GB/s)   </th><th class="markdownTableHeadNone">stringify (GB/s)    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">yyjson(insitu)   </td><td class="markdownTableBodyNone">3.51   </td><td class="markdownTableBodyNone">2.41    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">yyjson   </td><td class="markdownTableBodyNone">2.39   </td><td class="markdownTableBodyNone">2.01    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">simdjson   </td><td class="markdownTableBodyNone">2.19   </td><td class="markdownTableBodyNone">0.80    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">sajson   </td><td class="markdownTableBodyNone" colspan="2">1.74    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">rapidjson(insitu)   </td><td class="markdownTableBodyNone">0.75   </td><td class="markdownTableBodyNone"></td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">rapidjson(utf8)   </td><td class="markdownTableBodyNone">0.30   </td><td class="markdownTableBodyNone">0.58    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">cjson   </td><td class="markdownTableBodyNone">0.48   </td><td class="markdownTableBodyNone">0.33    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">jansson   </td><td class="markdownTableBodyNone">0.09   </td><td class="markdownTableBodyNone">0.24   </td></tr>
</table>
<p >More benchmark reports with interactive charts (update 2020-12-12)</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Platform   </th><th class="markdownTableHeadNone">CPU   </th><th class="markdownTableHeadNone">Compiler   </th><th class="markdownTableHeadNone">OS   </th><th class="markdownTableHeadNone">Report    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Intel NUC 8i5   </td><td class="markdownTableBodyNone">Core i5-8259U   </td><td class="markdownTableBodyNone">msvc 2019   </td><td class="markdownTableBodyNone">Windows 10 2004   </td><td class="markdownTableBodyNone"><a href="https://ibireme.github.io/yyjson_benchmark/reports/Intel_NUC_8i5_msvc_2019.html">Charts</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Intel NUC 8i5   </td><td class="markdownTableBodyNone">Core i5-8259U   </td><td class="markdownTableBodyNone">clang 10.0   </td><td class="markdownTableBodyNone">Ubuntu 20.04   </td><td class="markdownTableBodyNone"><a href="https://ibireme.github.io/yyjson_benchmark/reports/Intel_NUC_8i5_clang_10.html">Charts</a>    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">Intel NUC 8i5   </td><td class="markdownTableBodyNone">Core i5-8259U   </td><td class="markdownTableBodyNone">gcc 9.3   </td><td class="markdownTableBodyNone">Ubuntu 20.04   </td><td class="markdownTableBodyNone"><a href="https://ibireme.github.io/yyjson_benchmark/reports/Intel_NUC_8i5_gcc_9.html">Charts</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">AWS EC2 c5a.large   </td><td class="markdownTableBodyNone">AMD EPYC 7R32   </td><td class="markdownTableBodyNone">gcc 9.3   </td><td class="markdownTableBodyNone">Ubuntu 20.04   </td><td class="markdownTableBodyNone"><a href="https://ibireme.github.io/yyjson_benchmark/reports/EC2_c5a.large_gcc_9.html">Charts</a>    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">AWS EC2 t4g.medium   </td><td class="markdownTableBodyNone">Graviton2 (ARM64)   </td><td class="markdownTableBodyNone">gcc 9.3   </td><td class="markdownTableBodyNone">Ubuntu 20.04   </td><td class="markdownTableBodyNone"><a href="https://ibireme.github.io/yyjson_benchmark/reports/EC2_t4g.medium_gcc_9.html">Charts</a>    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">Apple iPhone 12 Pro   </td><td class="markdownTableBodyNone">A14 (ARM64)   </td><td class="markdownTableBodyNone">clang 12.0   </td><td class="markdownTableBodyNone">iOS 14   </td><td class="markdownTableBodyNone"><a href="https://ibireme.github.io/yyjson_benchmark/reports/Apple_A14_clang_12.html">Charts</a>   </td></tr>
</table>
<h3><a class="anchor" id="autotoc_md6"></a>
For better performance, yyjson prefers:</h3>
<ul>
<li>A modern processor with:<ul>
<li>high instruction level parallelism</li>
<li>excellent branch predictor</li>
<li>low penalty for misaligned memory access</li>
</ul>
</li>
<li>A modern compiler with good optimizer (e.g. clang)</li>
</ul>
<h1><a class="anchor" id="autotoc_md7"></a>
Sample Code</h1>
<h3><a class="anchor" id="autotoc_md8"></a>
Read JSON string</h3>
<div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *json = <span class="stringliteral">&quot;{\&quot;name\&quot;:\&quot;Mash\&quot;,\&quot;star\&quot;:4,\&quot;hits\&quot;:[2,2,1,3]}&quot;</span>;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Read JSON and get root</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__doc">yyjson_doc</a> *doc = <a class="code hl_function" href="yyjson_8h.html#aeab3c2a1d86225e5b181fb1bba7587d4">yyjson_read</a>(json, strlen(json), 0);</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *root = <a class="code hl_function" href="yyjson_8h.html#aa33a13a85b840b3dbc1f8534db2bd8fc">yyjson_doc_get_root</a>(doc);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Get root[&quot;name&quot;]</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *name = <a class="code hl_function" href="yyjson_8h.html#a1e8a4dea2e9e9248acde14c664ab702b">yyjson_obj_get</a>(root, <span class="stringliteral">&quot;name&quot;</span>);</div>
<div class="line">printf(<span class="stringliteral">&quot;name: %s\n&quot;</span>, <a class="code hl_function" href="yyjson_8h.html#a986e994db00b2749e000af0a4331454c">yyjson_get_str</a>(name));</div>
<div class="line">printf(<span class="stringliteral">&quot;name length:%d\n&quot;</span>, (<span class="keywordtype">int</span>)<a class="code hl_function" href="yyjson_8h.html#ae4b5e4edc9713d9f48e2a6750ad5ebff">yyjson_get_len</a>(name));</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Get root[&quot;star&quot;]</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *star = <a class="code hl_function" href="yyjson_8h.html#a1e8a4dea2e9e9248acde14c664ab702b">yyjson_obj_get</a>(root, <span class="stringliteral">&quot;star&quot;</span>);</div>
<div class="line">printf(<span class="stringliteral">&quot;star: %d\n&quot;</span>, (<span class="keywordtype">int</span>)<a class="code hl_function" href="yyjson_8h.html#a383b0a924785a30a49f6c59de235cd28">yyjson_get_int</a>(star));</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Get root[&quot;hits&quot;], iterate over the array</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *hits = <a class="code hl_function" href="yyjson_8h.html#a1e8a4dea2e9e9248acde14c664ab702b">yyjson_obj_get</a>(root, <span class="stringliteral">&quot;hits&quot;</span>);</div>
<div class="line"><span class="keywordtype">size_t</span> idx, max;</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *hit;</div>
<div class="line"><a class="code hl_define" href="yyjson_8h.html#a60fd8094ee3eff6e7b629471f50aa139">yyjson_arr_foreach</a>(hits, idx, max, hit) {</div>
<div class="line">    printf(<span class="stringliteral">&quot;hit%d: %d\n&quot;</span>, (<span class="keywordtype">int</span>)idx, (<span class="keywordtype">int</span>)<a class="code hl_function" href="yyjson_8h.html#a383b0a924785a30a49f6c59de235cd28">yyjson_get_int</a>(hit));</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Free the doc</span></div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#adad98bd766cf52d99f2c54dcb120786d">yyjson_doc_free</a>(doc);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// All functions accept NULL input, and return NULL on error.</span></div>
<div class="ttc" id="ayyjson_8h_html_a1e8a4dea2e9e9248acde14c664ab702b"><div class="ttname"><a href="yyjson_8h.html#a1e8a4dea2e9e9248acde14c664ab702b">yyjson_obj_get</a></div><div class="ttdeci">yyjson_api_inline yyjson_val * yyjson_obj_get(yyjson_val *obj, const char *key)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5174</div></div>
<div class="ttc" id="ayyjson_8h_html_a383b0a924785a30a49f6c59de235cd28"><div class="ttname"><a href="yyjson_8h.html#a383b0a924785a30a49f6c59de235cd28">yyjson_get_int</a></div><div class="ttdeci">yyjson_api_inline int yyjson_get_int(yyjson_val *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:4973</div></div>
<div class="ttc" id="ayyjson_8h_html_a60fd8094ee3eff6e7b629471f50aa139"><div class="ttname"><a href="yyjson_8h.html#a60fd8094ee3eff6e7b629471f50aa139">yyjson_arr_foreach</a></div><div class="ttdeci">#define yyjson_arr_foreach(arr, idx, max, val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:1884</div></div>
<div class="ttc" id="ayyjson_8h_html_a986e994db00b2749e000af0a4331454c"><div class="ttname"><a href="yyjson_8h.html#a986e994db00b2749e000af0a4331454c">yyjson_get_str</a></div><div class="ttdeci">yyjson_api_inline const char * yyjson_get_str(yyjson_val *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:4985</div></div>
<div class="ttc" id="ayyjson_8h_html_aa33a13a85b840b3dbc1f8534db2bd8fc"><div class="ttname"><a href="yyjson_8h.html#aa33a13a85b840b3dbc1f8534db2bd8fc">yyjson_doc_get_root</a></div><div class="ttdeci">yyjson_api_inline yyjson_val * yyjson_doc_get_root(yyjson_doc *doc)</div><div class="ttdef"><b>Definition:</b> yyjson.h:4839</div></div>
<div class="ttc" id="ayyjson_8h_html_adad98bd766cf52d99f2c54dcb120786d"><div class="ttname"><a href="yyjson_8h.html#adad98bd766cf52d99f2c54dcb120786d">yyjson_doc_free</a></div><div class="ttdeci">yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc)</div><div class="ttdef"><b>Definition:</b> yyjson.h:4851</div></div>
<div class="ttc" id="ayyjson_8h_html_ae4b5e4edc9713d9f48e2a6750ad5ebff"><div class="ttname"><a href="yyjson_8h.html#ae4b5e4edc9713d9f48e2a6750ad5ebff">yyjson_get_len</a></div><div class="ttdeci">yyjson_api_inline size_t yyjson_get_len(yyjson_val *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:4989</div></div>
<div class="ttc" id="ayyjson_8h_html_aeab3c2a1d86225e5b181fb1bba7587d4"><div class="ttname"><a href="yyjson_8h.html#aeab3c2a1d86225e5b181fb1bba7587d4">yyjson_read</a></div><div class="ttdeci">yyjson_api_inline yyjson_doc * yyjson_read(const char *dat, size_t len, yyjson_read_flag flg)</div><div class="ttdef"><b>Definition:</b> yyjson.h:954</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__doc"><div class="ttname"><a href="yyjson_8h.html#structyyjson__doc">yyjson_doc</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:4519</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__val"><div class="ttname"><a href="yyjson_8h.html#structyyjson__val">yyjson_val</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:4514</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md9"></a>
Write JSON string</h3>
<div class="fragment"><div class="line"><span class="comment">// Create a mutable doc</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__doc">yyjson_mut_doc</a> *doc = <a class="code hl_function" href="yyjson_8h.html#ae27cb375110302ec19f4376d7cab3c5b">yyjson_mut_doc_new</a>(NULL);</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__val">yyjson_mut_val</a> *root = <a class="code hl_function" href="yyjson_8h.html#a721dacf0e32ee6c7f18817aca806e9b2">yyjson_mut_obj</a>(doc);</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a8a9f7ea865526acb97ee4eff8d0bb79f">yyjson_mut_doc_set_root</a>(doc, root);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Set root[&quot;name&quot;] and root[&quot;star&quot;]</span></div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a996f8aa51f4c1475448974cf98f28df3">yyjson_mut_obj_add_str</a>(doc, root, <span class="stringliteral">&quot;name&quot;</span>, <span class="stringliteral">&quot;Mash&quot;</span>);</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a56726ff7e284700736e26e56afa6cf7b">yyjson_mut_obj_add_int</a>(doc, root, <span class="stringliteral">&quot;star&quot;</span>, 4);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Set root[&quot;hits&quot;] with an array</span></div>
<div class="line"><span class="keywordtype">int</span> hits_arr[] = {2, 2, 1, 3};</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__val">yyjson_mut_val</a> *hits = <a class="code hl_function" href="yyjson_8h.html#a54bfa0c027fb21e9e5c33a9f4ecbe0f5">yyjson_mut_arr_with_sint32</a>(doc, hits_arr, 4);</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a210aa96478b0b005b1611fe2f0ecbaa2">yyjson_mut_obj_add_val</a>(doc, root, <span class="stringliteral">&quot;hits&quot;</span>, hits);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// To string, minified</span></div>
<div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *json = <a class="code hl_function" href="yyjson_8h.html#a881e2ee3f487385810829df8bc675f1f">yyjson_mut_write</a>(doc, 0, NULL);</div>
<div class="line"><span class="keywordflow">if</span> (json) {</div>
<div class="line">    printf(<span class="stringliteral">&quot;json: %s\n&quot;</span>, json); <span class="comment">// {&quot;name&quot;:&quot;Mash&quot;,&quot;star&quot;:4,&quot;hits&quot;:[2,2,1,3]}</span></div>
<div class="line">    free((<span class="keywordtype">void</span> *)json);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Free the doc</span></div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a7a5f504993031f912d06777b8a7b5aff">yyjson_mut_doc_free</a>(doc);</div>
<div class="ttc" id="ayyjson_8h_html_a210aa96478b0b005b1611fe2f0ecbaa2"><div class="ttname"><a href="yyjson_8h.html#a210aa96478b0b005b1611fe2f0ecbaa2">yyjson_mut_obj_add_val</a></div><div class="ttdeci">yyjson_api_inline bool yyjson_mut_obj_add_val(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, yyjson_mut_val *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:7013</div></div>
<div class="ttc" id="ayyjson_8h_html_a54bfa0c027fb21e9e5c33a9f4ecbe0f5"><div class="ttname"><a href="yyjson_8h.html#a54bfa0c027fb21e9e5c33a9f4ecbe0f5">yyjson_mut_arr_with_sint32</a></div><div class="ttdeci">yyjson_api_inline yyjson_mut_val * yyjson_mut_arr_with_sint32(yyjson_mut_doc *doc, const int32_t *vals, size_t count)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5983</div></div>
<div class="ttc" id="ayyjson_8h_html_a56726ff7e284700736e26e56afa6cf7b"><div class="ttname"><a href="yyjson_8h.html#a56726ff7e284700736e26e56afa6cf7b">yyjson_mut_obj_add_int</a></div><div class="ttdeci">yyjson_api_inline bool yyjson_mut_obj_add_int(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, int64_t val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6925</div></div>
<div class="ttc" id="ayyjson_8h_html_a721dacf0e32ee6c7f18817aca806e9b2"><div class="ttname"><a href="yyjson_8h.html#a721dacf0e32ee6c7f18817aca806e9b2">yyjson_mut_obj</a></div><div class="ttdeci">yyjson_api_inline yyjson_mut_val * yyjson_mut_obj(yyjson_mut_doc *doc)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6579</div></div>
<div class="ttc" id="ayyjson_8h_html_a7a5f504993031f912d06777b8a7b5aff"><div class="ttname"><a href="yyjson_8h.html#a7a5f504993031f912d06777b8a7b5aff">yyjson_mut_doc_free</a></div><div class="ttdeci">yyjson_api void yyjson_mut_doc_free(yyjson_mut_doc *doc)</div></div>
<div class="ttc" id="ayyjson_8h_html_a881e2ee3f487385810829df8bc675f1f"><div class="ttname"><a href="yyjson_8h.html#a881e2ee3f487385810829df8bc675f1f">yyjson_mut_write</a></div><div class="ttdeci">yyjson_api_inline char * yyjson_mut_write(const yyjson_mut_doc *doc, yyjson_write_flag flg, size_t *len)</div><div class="ttdef"><b>Definition:</b> yyjson.h:1361</div></div>
<div class="ttc" id="ayyjson_8h_html_a8a9f7ea865526acb97ee4eff8d0bb79f"><div class="ttname"><a href="yyjson_8h.html#a8a9f7ea865526acb97ee4eff8d0bb79f">yyjson_mut_doc_set_root</a></div><div class="ttdeci">yyjson_api_inline void yyjson_mut_doc_set_root(yyjson_mut_doc *doc, yyjson_mut_val *root)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5396</div></div>
<div class="ttc" id="ayyjson_8h_html_a996f8aa51f4c1475448974cf98f28df3"><div class="ttname"><a href="yyjson_8h.html#a996f8aa51f4c1475448974cf98f28df3">yyjson_mut_obj_add_str</a></div><div class="ttdeci">yyjson_api_inline bool yyjson_mut_obj_add_str(yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6945</div></div>
<div class="ttc" id="ayyjson_8h_html_ae27cb375110302ec19f4376d7cab3c5b"><div class="ttname"><a href="yyjson_8h.html#ae27cb375110302ec19f4376d7cab3c5b">yyjson_mut_doc_new</a></div><div class="ttdeci">yyjson_api yyjson_mut_doc * yyjson_mut_doc_new(const yyjson_alc *alc)</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__mut__doc"><div class="ttname"><a href="yyjson_8h.html#structyyjson__mut__doc">yyjson_mut_doc</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:5329</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__mut__val"><div class="ttname"><a href="yyjson_8h.html#structyyjson__mut__val">yyjson_mut_val</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:5281</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md10"></a>
Read JSON file with options</h3>
<div class="fragment"><div class="line"><span class="comment">// Read JSON file, allowing comments and trailing commas</span></div>
<div class="line"><a class="code hl_typedef" href="yyjson_8h.html#a36af676813028c1360e8b343768f0e81">yyjson_read_flag</a> flg = <a class="code hl_variable" href="yyjson_8h.html#aff1d62b68993630e74355e4611b77520">YYJSON_READ_ALLOW_COMMENTS</a> | <a class="code hl_variable" href="yyjson_8h.html#a046c7832484dab943bed61ffac274e9c">YYJSON_READ_ALLOW_TRAILING_COMMAS</a>;</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__read__err">yyjson_read_err</a> err;</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__doc">yyjson_doc</a> *doc = <a class="code hl_function" href="yyjson_8h.html#a605ac08b083fb65331d7fa5eb5d32225">yyjson_read_file</a>(<span class="stringliteral">&quot;/tmp/config.json&quot;</span>, flg, NULL, &amp;err);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Iterate over the root object</span></div>
<div class="line"><span class="keywordflow">if</span> (doc) {</div>
<div class="line">    <a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *obj = <a class="code hl_function" href="yyjson_8h.html#aa33a13a85b840b3dbc1f8534db2bd8fc">yyjson_doc_get_root</a>(doc);</div>
<div class="line">    <a class="code hl_struct" href="yyjson_8h.html#structyyjson__obj__iter">yyjson_obj_iter</a> iter;</div>
<div class="line">    <a class="code hl_function" href="yyjson_8h.html#a2b6a426ece4ffeb9dede1f7a9970140d">yyjson_obj_iter_init</a>(obj, &amp;iter);</div>
<div class="line">    <a class="code hl_struct" href="yyjson_8h.html#structyyjson__val">yyjson_val</a> *key, *val;</div>
<div class="line">    <span class="keywordflow">while</span> ((key = <a class="code hl_function" href="yyjson_8h.html#a6033befb82b9331d2c19c09799ec5bcf">yyjson_obj_iter_next</a>(&amp;iter))) {</div>
<div class="line">        val = <a class="code hl_function" href="yyjson_8h.html#a3403b9c25c8b8f2b3027f4e6d97d0ca8">yyjson_obj_iter_get_val</a>(key);</div>
<div class="line">        printf(<span class="stringliteral">&quot;%s: %s\n&quot;</span>, <a class="code hl_function" href="yyjson_8h.html#a986e994db00b2749e000af0a4331454c">yyjson_get_str</a>(key), <a class="code hl_function" href="yyjson_8h.html#a489b91cc6038a17ebc90193bc00e9e8b">yyjson_get_type_desc</a>(val));</div>
<div class="line">    }</div>
<div class="line">} <span class="keywordflow">else</span> {</div>
<div class="line">    printf(<span class="stringliteral">&quot;read error (%u): %s at position: %ld\n&quot;</span>, err.<a class="code hl_variable" href="yyjson_8h.html#a550600110929a7030f464a460b5b62cb">code</a>, err.<a class="code hl_variable" href="yyjson_8h.html#a9044823fa7fb431019662e589d45707c">msg</a>, err.<a class="code hl_variable" href="yyjson_8h.html#a87eb200779eff088b93ea0a67ab3e300">pos</a>);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Free the doc</span></div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#adad98bd766cf52d99f2c54dcb120786d">yyjson_doc_free</a>(doc);</div>
<div class="ttc" id="ayyjson_8h_html_a046c7832484dab943bed61ffac274e9c"><div class="ttname"><a href="yyjson_8h.html#a046c7832484dab943bed61ffac274e9c">YYJSON_READ_ALLOW_TRAILING_COMMAS</a></div><div class="ttdeci">static const yyjson_read_flag YYJSON_READ_ALLOW_TRAILING_COMMAS</div><div class="ttdef"><b>Definition:</b> yyjson.h:758</div></div>
<div class="ttc" id="ayyjson_8h_html_a2b6a426ece4ffeb9dede1f7a9970140d"><div class="ttname"><a href="yyjson_8h.html#a2b6a426ece4ffeb9dede1f7a9970140d">yyjson_obj_iter_init</a></div><div class="ttdeci">yyjson_api_inline bool yyjson_obj_iter_init(yyjson_val *obj, yyjson_obj_iter *iter)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5199</div></div>
<div class="ttc" id="ayyjson_8h_html_a3403b9c25c8b8f2b3027f4e6d97d0ca8"><div class="ttname"><a href="yyjson_8h.html#a3403b9c25c8b8f2b3027f4e6d97d0ca8">yyjson_obj_iter_get_val</a></div><div class="ttdeci">yyjson_api_inline yyjson_val * yyjson_obj_iter_get_val(yyjson_val *key)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5232</div></div>
<div class="ttc" id="ayyjson_8h_html_a36af676813028c1360e8b343768f0e81"><div class="ttname"><a href="yyjson_8h.html#a36af676813028c1360e8b343768f0e81">yyjson_read_flag</a></div><div class="ttdeci">uint32_t yyjson_read_flag</div><div class="ttdef"><b>Definition:</b> yyjson.h:731</div></div>
<div class="ttc" id="ayyjson_8h_html_a489b91cc6038a17ebc90193bc00e9e8b"><div class="ttname"><a href="yyjson_8h.html#a489b91cc6038a17ebc90193bc00e9e8b">yyjson_get_type_desc</a></div><div class="ttdeci">yyjson_api_inline const char * yyjson_get_type_desc(yyjson_val *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:4940</div></div>
<div class="ttc" id="ayyjson_8h_html_a550600110929a7030f464a460b5b62cb"><div class="ttname"><a href="yyjson_8h.html#a550600110929a7030f464a460b5b62cb">yyjson_read_err::code</a></div><div class="ttdeci">yyjson_read_code code</div><div class="ttdef"><b>Definition:</b> yyjson.h:837</div></div>
<div class="ttc" id="ayyjson_8h_html_a6033befb82b9331d2c19c09799ec5bcf"><div class="ttname"><a href="yyjson_8h.html#a6033befb82b9331d2c19c09799ec5bcf">yyjson_obj_iter_next</a></div><div class="ttdeci">yyjson_api_inline yyjson_val * yyjson_obj_iter_next(yyjson_obj_iter *iter)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5222</div></div>
<div class="ttc" id="ayyjson_8h_html_a605ac08b083fb65331d7fa5eb5d32225"><div class="ttname"><a href="yyjson_8h.html#a605ac08b083fb65331d7fa5eb5d32225">yyjson_read_file</a></div><div class="ttdeci">yyjson_api yyjson_doc * yyjson_read_file(const char *path, yyjson_read_flag flg, const yyjson_alc *alc, yyjson_read_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_a87eb200779eff088b93ea0a67ab3e300"><div class="ttname"><a href="yyjson_8h.html#a87eb200779eff088b93ea0a67ab3e300">yyjson_read_err::pos</a></div><div class="ttdeci">size_t pos</div><div class="ttdef"><b>Definition:</b> yyjson.h:841</div></div>
<div class="ttc" id="ayyjson_8h_html_a9044823fa7fb431019662e589d45707c"><div class="ttname"><a href="yyjson_8h.html#a9044823fa7fb431019662e589d45707c">yyjson_read_err::msg</a></div><div class="ttdeci">const char * msg</div><div class="ttdef"><b>Definition:</b> yyjson.h:839</div></div>
<div class="ttc" id="ayyjson_8h_html_aff1d62b68993630e74355e4611b77520"><div class="ttname"><a href="yyjson_8h.html#aff1d62b68993630e74355e4611b77520">YYJSON_READ_ALLOW_COMMENTS</a></div><div class="ttdeci">static const yyjson_read_flag YYJSON_READ_ALLOW_COMMENTS</div><div class="ttdef"><b>Definition:</b> yyjson.h:761</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__obj__iter"><div class="ttname"><a href="yyjson_8h.html#structyyjson__obj__iter">yyjson_obj_iter</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:1952</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__read__err"><div class="ttname"><a href="yyjson_8h.html#structyyjson__read__err">yyjson_read_err</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:835</div></div>
</div><!-- fragment --><h3><a class="anchor" id="autotoc_md11"></a>
Write JSON file with options</h3>
<div class="fragment"><div class="line"><span class="comment">// Read the JSON file as a mutable doc</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__doc">yyjson_doc</a> *idoc = <a class="code hl_function" href="yyjson_8h.html#a605ac08b083fb65331d7fa5eb5d32225">yyjson_read_file</a>(<span class="stringliteral">&quot;/tmp/config.json&quot;</span>, 0, NULL, NULL);</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__doc">yyjson_mut_doc</a> *doc = <a class="code hl_function" href="yyjson_8h.html#a083356ecb65e45453033285f3d836de9">yyjson_doc_mut_copy</a>(idoc, NULL);</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__val">yyjson_mut_val</a> *obj = <a class="code hl_function" href="yyjson_8h.html#aa33ac310f363ace5f4dda3697b2c0123">yyjson_mut_doc_get_root</a>(doc);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Remove null values in root object</span></div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__obj__iter">yyjson_mut_obj_iter</a> iter;</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#ad32e0e0427bda63164f12fe689a6f854">yyjson_mut_obj_iter_init</a>(obj, &amp;iter);</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__mut__val">yyjson_mut_val</a> *key, *val;</div>
<div class="line"><span class="keywordflow">while</span> ((key = <a class="code hl_function" href="yyjson_8h.html#a55f4228c2d65d497ad3cee8abe95c0be">yyjson_mut_obj_iter_next</a>(&amp;iter))) {</div>
<div class="line">    val = <a class="code hl_function" href="yyjson_8h.html#aaa4bef14b71ff145fe8cdc2fa98c7f45">yyjson_mut_obj_iter_get_val</a>(key);</div>
<div class="line">    <span class="keywordflow">if</span> (<a class="code hl_function" href="yyjson_8h.html#a17fda97923bb434d4214c56534586606">yyjson_mut_is_null</a>(val)) {</div>
<div class="line">        <a class="code hl_function" href="yyjson_8h.html#a6e891b4020dd6325d6eacb5e108da3c4">yyjson_mut_obj_iter_remove</a>(&amp;iter);</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Write the json pretty, escape unicode</span></div>
<div class="line"><a class="code hl_typedef" href="yyjson_8h.html#afb7989387fc481f678e13325c18e6338">yyjson_write_flag</a> flg = <a class="code hl_variable" href="yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be">YYJSON_WRITE_PRETTY</a> | <a class="code hl_variable" href="yyjson_8h.html#ac234e82f7a1203e656bcbb0af2ce8c01">YYJSON_WRITE_ESCAPE_UNICODE</a>;</div>
<div class="line"><a class="code hl_struct" href="yyjson_8h.html#structyyjson__write__err">yyjson_write_err</a> err;</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#ad2a7aa77fa66a593536e3d7c3edb1d7a">yyjson_mut_write_file</a>(<span class="stringliteral">&quot;/tmp/config.json&quot;</span>, doc, flg, NULL, &amp;err);</div>
<div class="line"><span class="keywordflow">if</span> (err.<a class="code hl_variable" href="yyjson_8h.html#ae4aa66c2b00d3173291dd48ae398b1c0">code</a>) {</div>
<div class="line">    printf(<span class="stringliteral">&quot;write error (%u): %s\n&quot;</span>, err.<a class="code hl_variable" href="yyjson_8h.html#ae4aa66c2b00d3173291dd48ae398b1c0">code</a>, err.<a class="code hl_variable" href="yyjson_8h.html#a3db87979e01ea1d86ce073b9e7218fe9">msg</a>);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// Free the doc</span></div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#adad98bd766cf52d99f2c54dcb120786d">yyjson_doc_free</a>(idoc);</div>
<div class="line"><a class="code hl_function" href="yyjson_8h.html#a7a5f504993031f912d06777b8a7b5aff">yyjson_mut_doc_free</a>(doc);</div>
<div class="ttc" id="ayyjson_8h_html_a083356ecb65e45453033285f3d836de9"><div class="ttname"><a href="yyjson_8h.html#a083356ecb65e45453033285f3d836de9">yyjson_doc_mut_copy</a></div><div class="ttdeci">yyjson_api yyjson_mut_doc * yyjson_doc_mut_copy(yyjson_doc *doc, const yyjson_alc *alc)</div></div>
<div class="ttc" id="ayyjson_8h_html_a17fda97923bb434d4214c56534586606"><div class="ttname"><a href="yyjson_8h.html#a17fda97923bb434d4214c56534586606">yyjson_mut_is_null</a></div><div class="ttdeci">yyjson_api_inline bool yyjson_mut_is_null(yyjson_mut_val *val)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5411</div></div>
<div class="ttc" id="ayyjson_8h_html_a3db87979e01ea1d86ce073b9e7218fe9"><div class="ttname"><a href="yyjson_8h.html#a3db87979e01ea1d86ce073b9e7218fe9">yyjson_write_err::msg</a></div><div class="ttdeci">const char * msg</div><div class="ttdef"><b>Definition:</b> yyjson.h:1155</div></div>
<div class="ttc" id="ayyjson_8h_html_a55f4228c2d65d497ad3cee8abe95c0be"><div class="ttname"><a href="yyjson_8h.html#a55f4228c2d65d497ad3cee8abe95c0be">yyjson_mut_obj_iter_next</a></div><div class="ttdeci">yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_next(yyjson_mut_obj_iter *iter)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6513</div></div>
<div class="ttc" id="ayyjson_8h_html_a6e891b4020dd6325d6eacb5e108da3c4"><div class="ttname"><a href="yyjson_8h.html#a6e891b4020dd6325d6eacb5e108da3c4">yyjson_mut_obj_iter_remove</a></div><div class="ttdeci">yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_remove(yyjson_mut_obj_iter *iter)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6530</div></div>
<div class="ttc" id="ayyjson_8h_html_aa33ac310f363ace5f4dda3697b2c0123"><div class="ttname"><a href="yyjson_8h.html#aa33ac310f363ace5f4dda3697b2c0123">yyjson_mut_doc_get_root</a></div><div class="ttdeci">yyjson_api_inline yyjson_mut_val * yyjson_mut_doc_get_root(yyjson_mut_doc *doc)</div><div class="ttdef"><b>Definition:</b> yyjson.h:5392</div></div>
<div class="ttc" id="ayyjson_8h_html_aaa4bef14b71ff145fe8cdc2fa98c7f45"><div class="ttname"><a href="yyjson_8h.html#aaa4bef14b71ff145fe8cdc2fa98c7f45">yyjson_mut_obj_iter_get_val</a></div><div class="ttdeci">yyjson_api_inline yyjson_mut_val * yyjson_mut_obj_iter_get_val(yyjson_mut_val *key)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6525</div></div>
<div class="ttc" id="ayyjson_8h_html_ac234e82f7a1203e656bcbb0af2ce8c01"><div class="ttname"><a href="yyjson_8h.html#ac234e82f7a1203e656bcbb0af2ce8c01">YYJSON_WRITE_ESCAPE_UNICODE</a></div><div class="ttdeci">static const yyjson_write_flag YYJSON_WRITE_ESCAPE_UNICODE</div><div class="ttdef"><b>Definition:</b> yyjson.h:1094</div></div>
<div class="ttc" id="ayyjson_8h_html_ad2a7aa77fa66a593536e3d7c3edb1d7a"><div class="ttname"><a href="yyjson_8h.html#ad2a7aa77fa66a593536e3d7c3edb1d7a">yyjson_mut_write_file</a></div><div class="ttdeci">yyjson_api bool yyjson_mut_write_file(const char *path, const yyjson_mut_doc *doc, yyjson_write_flag flg, const yyjson_alc *alc, yyjson_write_err *err)</div></div>
<div class="ttc" id="ayyjson_8h_html_ad32e0e0427bda63164f12fe689a6f854"><div class="ttname"><a href="yyjson_8h.html#ad32e0e0427bda63164f12fe689a6f854">yyjson_mut_obj_iter_init</a></div><div class="ttdeci">yyjson_api_inline bool yyjson_mut_obj_iter_init(yyjson_mut_val *obj, yyjson_mut_obj_iter *iter)</div><div class="ttdef"><b>Definition:</b> yyjson.h:6488</div></div>
<div class="ttc" id="ayyjson_8h_html_ae4aa66c2b00d3173291dd48ae398b1c0"><div class="ttname"><a href="yyjson_8h.html#ae4aa66c2b00d3173291dd48ae398b1c0">yyjson_write_err::code</a></div><div class="ttdeci">yyjson_write_code code</div><div class="ttdef"><b>Definition:</b> yyjson.h:1153</div></div>
<div class="ttc" id="ayyjson_8h_html_aebdaa55a1673e99d2dcea01a15c633be"><div class="ttname"><a href="yyjson_8h.html#aebdaa55a1673e99d2dcea01a15c633be">YYJSON_WRITE_PRETTY</a></div><div class="ttdeci">static const yyjson_write_flag YYJSON_WRITE_PRETTY</div><div class="ttdef"><b>Definition:</b> yyjson.h:1091</div></div>
<div class="ttc" id="ayyjson_8h_html_afb7989387fc481f678e13325c18e6338"><div class="ttname"><a href="yyjson_8h.html#afb7989387fc481f678e13325c18e6338">yyjson_write_flag</a></div><div class="ttdeci">uint32_t yyjson_write_flag</div><div class="ttdef"><b>Definition:</b> yyjson.h:1081</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__mut__obj__iter"><div class="ttname"><a href="yyjson_8h.html#structyyjson__mut__obj__iter">yyjson_mut_obj_iter</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:3310</div></div>
<div class="ttc" id="ayyjson_8h_html_structyyjson__write__err"><div class="ttname"><a href="yyjson_8h.html#structyyjson__write__err">yyjson_write_err</a></div><div class="ttdef"><b>Definition:</b> yyjson.h:1151</div></div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md12"></a>
Documentation</h1>
<p >The latest (unreleased) documentation can be accessed in the <a href="https://github.com/ibireme/yyjson/tree/master/doc">doc</a> directory. The pre-generated Doxygen HTML for the release version can be viewed here:</p><ul>
<li><a href="https://ibireme.github.io/yyjson/doc/doxygen/html/">Home Page</a><ul>
<li><a href="https://ibireme.github.io/yyjson/doc/doxygen/html/md_doc__build_and_test.html">Build and test</a></li>
<li><a href="https://ibireme.github.io/yyjson/doc/doxygen/html/md_doc__a_p_i.html">API and sample code</a></li>
<li><a href="https://ibireme.github.io/yyjson/doc/doxygen/html/md_doc__data_structure.html">Data structure</a></li>
<li><a href="https://ibireme.github.io/yyjson/doc/doxygen/html/md__c_h_a_n_g_e_l_o_g.html">Changelog</a></li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md13"></a>
Packaging status</h1>
<p ><a href="https://repology.org/project/yyjson/versions"><img src="https://repology.org/badge/vertical-allrepos/yyjson.svg" alt="Packaging status" style="pointer-events: none;" class="inline"/></a></p>
<h1><a class="anchor" id="autotoc_md14"></a>
Built With yyjson</h1>
<p >A non-exhaustive list of projects that expose yyjson to other languages or use yyjson internally for a major feature. If you have a project that uses yyjson, feel free to open a PR to add it to this list.</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Project   </th><th class="markdownTableHeadNone">Language   </th><th class="markdownTableHeadNone">Description    </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a href="https://github.com/tktech/py_yyjson">py_yyjson</a>   </td><td class="markdownTableBodyNone">Python   </td><td class="markdownTableBodyNone">Python bindings for yyjson    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a href="https://github.com/ijl/orjson">orjson</a>   </td><td class="markdownTableBodyNone">Python   </td><td class="markdownTableBodyNone">JSON library for Python with an optional yyjson backend    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a href="https://github.com/yosh-matsuda/cpp-yyjson">cpp-yyjson</a>   </td><td class="markdownTableBodyNone">C++   </td><td class="markdownTableBodyNone">C++ JSON library with a yyjson backend    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a href="https://github.com/getml/reflect-cpp">reflect-cpp</a>   </td><td class="markdownTableBodyNone">C++   </td><td class="markdownTableBodyNone">C++ library for serialization through automated field name retrieval from structs    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a href="https://github.com/coolbutuseless/yyjsonr">yyjsonr</a>   </td><td class="markdownTableBodyNone">R   </td><td class="markdownTableBodyNone">R binding for yyjson    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a href="https://github.com/nixzhu/Ananda">Ananda</a>   </td><td class="markdownTableBodyNone">Swift   </td><td class="markdownTableBodyNone">JSON model decoding based on yyjson    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a href="https://github.com/duckdb/duckdb">duckdb</a>   </td><td class="markdownTableBodyNone">C++   </td><td class="markdownTableBodyNone">DuckDB is an in-process SQL OLAP Database Management System    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a href="https://github.com/fastfetch-cli/fastfetch">fastfetch</a>   </td><td class="markdownTableBodyNone">C   </td><td class="markdownTableBodyNone">A neofetch-like tool for fetching system information and displaying them in a pretty way    </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone"><a href="https://github.com/zrythm/zrythm">Zrythm</a>   </td><td class="markdownTableBodyNone">C   </td><td class="markdownTableBodyNone">Digital Audio Workstation that uses yyjson to serialize JSON project files    </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone"><a href="https://github.com/BeMoreHumanOrg/bemorehuman">bemorehuman</a>   </td><td class="markdownTableBodyNone">C   </td><td class="markdownTableBodyNone">Recommendation engine with a focus on uniqueness of the person receiving the rec   </td></tr>
</table>
<h1><a class="anchor" id="autotoc_md15"></a>
TODO for v1.0</h1>
<ul>
<li>[x] Add documentation page.</li>
<li>[x] Add GitHub workflow for CI and codecov.</li>
<li>[x] Add more tests: valgrind, sanitizer, fuzzing.</li>
<li>[x] Support JSON Pointer to query and modify JSON.</li>
<li>[x] Add <code>RAW</code> type for JSON reader and writer.</li>
<li>[ ] Add option to limit real number output precision.</li>
<li>[ ] Add option to support JSON5 (if feasible).</li>
<li>[ ] Add functions to diff two JSON documents.</li>
<li>[ ] Add documentation on performance optimizations.</li>
<li>[ ] Ensure ABI stability.</li>
</ul>
<h1><a class="anchor" id="autotoc_md16"></a>
License</h1>
<p >This project is released under the MIT license. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.9.4-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Documentation for <a href="https://github.com/ibireme/yyjson" target="_blank">yyjson</a>, generated by <a href="https://www.doxygen.org/index.html" target="_blank">doxygen</a> 1.9.4 </li>
  </ul>
</div>
</body>
</html>
